package asteroids.statements;


import java.util.*;

import be.kuleuven.cs.som.annotate.Basic;

import asteroids.Ship;
import asteroids.expressions.*;
import asteroids.types.Type;

public class PrintStatement extends BasicStatement {

	private Expression expression;
	
	public PrintStatement(int line, int column, Expression expression) {
		super(line, column);
		this.expression = expression;
	}
	
	@Basic
	public Expression getExpression() {
		return expression;
	}

	@Override
	public void execute(Ship ship) {
		System.out.println(getExpression().evaluate(ship, ship.getProgram().getGlobals()).getValue());
	}

	@Override
	public List<String> getTypeCheckErrors(List<String> typeErrors, Map<String, Type> globalVariables) {
		return typeErrors;
	}

	@Override
	public boolean hasActionStatement() {
		return false;
	}

}
